package com.ruoyi.algorithm.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

/**
 * @author dyk
 * @date 2021/7/8 19:07
 * @description
 */
@Component
public class MultipartConfig {

    // 解除上传文件限制
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        factory.setMaxRequestSize(DataSize.parse("10240MB"));
        factory.setMaxFileSize(DataSize.parse("10240MB"));
        return factory.createMultipartConfig();
    }
}
